package com.cedric.yixianpai.game.cards.Sects.swordCards.b_ZhuJi;

import com.cedric.yixianpai.game.Constants.Period;
import com.cedric.yixianpai.game.Status.DuelStatus;
import com.cedric.yixianpai.game.interfaces.SwordCard;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;

@Component
public class XingYiJian extends SwordCard {
    /**
     * 形意剑 -1SE 8/11/14
     * 击伤：剑意+3/4/5
     *
     * @param lvl 1/2/3
     */
    public XingYiJian(@Value("1") int lvl) {
        super("形意剑");
        this.setPeriod(Period.ZHUJI);
        this.setDescription("灵气-1 8/11/14攻 击伤：剑意+3/4/5");

        this.setSpiritNeed(1);
        if (1 == lvl) {
            this.setLevel(1);
            this.setDamage(8);
            this.setSwordIntent(3);
        } else if (2 == lvl) {
            this.setLevel(2);
            this.setDamage(11);
            this.setSwordIntent(4);
        } else if (3 == lvl) {
            this.setLevel(3);
            this.setDamage(14);
            this.setSwordIntent(5);
        } else {
            throw new RuntimeException("Card Level Error!");
        }
    }

    @Override
    public boolean effect(DuelStatus Sta1, DuelStatus Sta2) {
        if (Sta1.spiritEnough(this.getSpiritNeed())) {
            if (Sta1.attack(Sta2, this.getDamage()) > 0) {
                Sta1.getPlayerBuff().addSwordIntent(this.getSwordIntent());
            }
            return true;
        }
        return false;
    }
}
